package com.litlum.fibermana.dto;

import com.litlum.fibermana.entity.Pallet;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class PalletDTO {
    private Long id;
    private String code;
    private String twist;
    private String spec;
    private String grade;
    private String batch;

    public PalletDTO() {}

//    public PalletDTO(Long id, String code, String twist, String spec, String grade, String batch) {
//        this.id = id;
//        this.code = code;
//        this.twist = twist;
//        this.spec = spec;
//        this.grade = grade;
//        this.batch = batch;
//    }

    public Pallet toPallet(){
        Pallet pallet = new Pallet();
        pallet.setId(id);
        pallet.setCode(code);
        pallet.setTwist(twist);
        pallet.setSpec(spec);
        pallet.setGrade(grade);
        pallet.setBatch(batch);
        return pallet;
    }

    public static PalletDTO fromPallet(Pallet pallet){
        PalletDTO palletDTO = new PalletDTO();
        palletDTO.setId(pallet.getId());
        palletDTO.setCode(pallet.getCode());
        palletDTO.setTwist(pallet.getTwist());
        palletDTO.setSpec(pallet.getSpec());
        palletDTO.setGrade(pallet.getGrade());
        palletDTO.setBatch(pallet.getBatch());
        return palletDTO;
    }
}
